package nav

/*
#include<stdint.h>
#include<stdbool.h>
extern void nav_dtPathCorridor_Delete(void * c_this);
extern void nav_dtPathCorridor_DeleteArray(void * c_this);
extern void* nav_NewdtPathCorridor();
extern int nav_dtPathCorridor_findCorners(void * c_this,void * cornerVerts,void * cornerFlags,void * cornerPolys,int maxCorners,void * navquery,void * filter);
extern bool nav_dtPathCorridor_fixPathStart(void * c_this,unsigned int safeRef,void * safePos);
extern unsigned int nav_dtPathCorridor_getFirstPoly(void * c_this);
extern unsigned int nav_dtPathCorridor_getLastPoly(void * c_this);
extern void * nav_dtPathCorridor_getPath(void * c_this);
extern int nav_dtPathCorridor_getPathCount(void * c_this);
extern void * nav_dtPathCorridor_getPos(void * c_this);
extern void * nav_dtPathCorridor_getTarget(void * c_this);
extern void * nav_dtPathCorridor_IndexArray(void * c_this,long n);
extern bool nav_dtPathCorridor_init(void * c_this,int maxPath);
extern bool nav_dtPathCorridor_isValid(void * c_this,int maxLookAhead,void * navquery,void * filter);
extern bool nav_dtPathCorridor_moveOverOffmeshConnection(void * c_this,unsigned int offMeshConRef,void * refs,void * startPos,void * endPos,void * navquery);
extern bool nav_dtPathCorridor_movePosition(void * c_this,void * npos,void * navquery,void * filter);
extern bool nav_dtPathCorridor_moveTargetPosition(void * c_this,void * npos,void * navquery,void * filter);
extern bool nav_dtPathCorridor_optimizePathTopology(void * c_this,void * navquery,void * filter);
extern void nav_dtPathCorridor_optimizePathVisibility(void * c_this,void * next,float pathOptimizationRange,void * navquery,void * filter);
extern void nav_dtPathCorridor_reset(void * c_this,unsigned int ref,void * pos);
extern void nav_dtPathCorridor_setCorridor(void * c_this,void * target,void * polys,int npath);
extern bool nav_dtPathCorridor_trimInvalidPath(void * c_this,unsigned int safeRef,void * safePos,void * navquery,void * filter);
extern int nav_dtMergeCorridorEndMoved(void * path,int npath,int maxPath,void * visited,int nvisited);
extern int nav_dtMergeCorridorStartMoved(void * path,int npath,int maxPath,void * visited,int nvisited);
extern int nav_dtMergeCorridorStartShortcut(void * path,int npath,int maxPath,void * visited,int nvisited);
extern void * nav_NewDtPathCorridorPtrArray(long n);

*/
import "C"
import "unsafe"
import "gitee.com/hasika/cgo"

var _ unsafe.Pointer
var _ cgo.NotUsed

/*
Represents a dynamic polygon corridor used to plan agent movement.

	crowd, detour
*/
type DtPathCorridorPtr uintptr

/*
public void Delete()
*/
func (p DtPathCorridorPtr) Delete() {
	var wrap_this unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	C.nav_dtPathCorridor_Delete(wrap_this)
}

/*
void DeleteArray()
*/
func (p DtPathCorridorPtr) DeleteArray() {
	var wrap_this unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	C.nav_dtPathCorridor_DeleteArray(wrap_this)
}

/*
public dtPathCorridor()
*/
func NewDtPathCorridor() cgo.GoManagedPtr[DtPathCorridorPtr] {
	wrap_out := C.nav_NewdtPathCorridor()
	go_out := cgo.MakePtr[cgo.GoManagedPtr[DtPathCorridorPtr]](uintptr(wrap_out))
	return go_out
}

/*
Finds the corners in the corridor from the position toward the target. (The straightened path.)

@param cornerVerts The corner vertices. [(x, y, z) * cornerCount] [Size:
<
= maxCorners]
@param cornerFlags The flag for each corner. [(flag) * cornerCount] [Size:
<
= maxCorners]
@param cornerPolys The polygon reference for each corner. [(polyRef) * cornerCount]
[Size:
<
= @p maxCorners]
@param maxCorners The maximum number of corners the buffers can hold.
@param navquery The query object used to build the corridor.
@param filter The filter to apply to the operation.
@return The number of corners returned in the corner buffers. [0
<
= value
<
= @p maxCorners]

public int findCorners(float * cornerVerts, unsigned char * cornerFlags, dtPolyRef * cornerPolys, int const maxCorners, dtNavMeshQuery * navquery, dtQueryFilter const * filter)
*/
func (p DtPathCorridorPtr) FindCorners(cornerVerts *float32, cornerFlags *uint8, cornerPolys *uint32, maxCorners int32, navquery DtNavMeshQueryPtr, filter DtQueryFilterPtr) int32 {
	var wrap_this unsafe.Pointer
	var wrap_arg_cornerVerts unsafe.Pointer
	var wrap_arg_cornerFlags unsafe.Pointer
	var wrap_arg_cornerPolys unsafe.Pointer
	var wrap_arg_maxCorners C.int
	var wrap_arg_navquery unsafe.Pointer
	var wrap_arg_filter unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_arg_cornerVerts = (unsafe.Pointer)(cornerVerts)
	wrap_arg_cornerFlags = (unsafe.Pointer)(cornerFlags)
	wrap_arg_cornerPolys = (unsafe.Pointer)(cornerPolys)
	wrap_arg_maxCorners = (C.int)(maxCorners)
	wrap_arg_navquery = (unsafe.Pointer)(navquery)
	wrap_arg_filter = (unsafe.Pointer)(filter)
	wrap_out := C.nav_dtPathCorridor_findCorners(wrap_this, wrap_arg_cornerVerts, wrap_arg_cornerFlags, wrap_arg_cornerPolys, wrap_arg_maxCorners, wrap_arg_navquery, wrap_arg_filter)
	go_out := int32(wrap_out)
	return go_out
}

/*
public bool fixPathStart(dtPolyRef safeRef, float const * safePos)
*/
func (p DtPathCorridorPtr) FixPathStart(safeRef uint32, safePos *float32) bool {
	var wrap_this unsafe.Pointer
	var wrap_arg_safeRef C.uint
	var wrap_arg_safePos unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_arg_safeRef = (C.uint)(safeRef)
	wrap_arg_safePos = (unsafe.Pointer)(safePos)
	wrap_out := C.nav_dtPathCorridor_fixPathStart(wrap_this, wrap_arg_safeRef, wrap_arg_safePos)
	go_out := bool(wrap_out)
	return go_out
}

/*
The polygon reference id of the first polygon in the corridor, the polygon containing the position.

@return The polygon reference id of the first polygon in the corridor. (Or zero if there is no path.)

public dtPolyRef getFirstPoly() const
*/
func (p DtPathCorridorPtr) GetFirstPoly() uint32 {
	var wrap_this unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_out := C.nav_dtPathCorridor_getFirstPoly(wrap_this)
	go_out := uint32(wrap_out)
	return go_out
}

/*
The polygon reference id of the last polygon in the corridor, the polygon containing the target.

@return The polygon reference id of the last polygon in the corridor. (Or zero if there is no path.)

public dtPolyRef getLastPoly() const
*/
func (p DtPathCorridorPtr) GetLastPoly() uint32 {
	var wrap_this unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_out := C.nav_dtPathCorridor_getLastPoly(wrap_this)
	go_out := uint32(wrap_out)
	return go_out
}

/*
The corridor's path.

@return The corridor's path. [(polyRef) * #getPathCount()]

public dtPolyRef const * getPath() const
*/
func (p DtPathCorridorPtr) GetPath() *uint32 {
	var wrap_this unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_out := C.nav_dtPathCorridor_getPath(wrap_this)
	go_out := (*uint32)(unsafe.Pointer(wrap_out))
	return go_out
}

/*
The number of polygons in the current corridor path.

@return The number of polygons in the current corridor path.

public int getPathCount() const
*/
func (p DtPathCorridorPtr) GetPathCount() int32 {
	var wrap_this unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_out := C.nav_dtPathCorridor_getPathCount(wrap_this)
	go_out := int32(wrap_out)
	return go_out
}

/*
Gets the current position within the corridor. (In the first polygon.)

@return The current position within the corridor.

public float const * getPos() const
*/
func (p DtPathCorridorPtr) GetPos() *float32 {
	var wrap_this unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_out := C.nav_dtPathCorridor_getPos(wrap_this)
	go_out := (*float32)(unsafe.Pointer(wrap_out))
	return go_out
}

/*
Gets the current target within the corridor. (In the last polygon.)

@return The current target within the corridor.

public float const * getTarget() const
*/
func (p DtPathCorridorPtr) GetTarget() *float32 {
	var wrap_this unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_out := C.nav_dtPathCorridor_getTarget(wrap_this)
	go_out := (*float32)(unsafe.Pointer(wrap_out))
	return go_out
}

/*
dtPathCorridor * IndexArray(long n)
*/
func (p DtPathCorridorPtr) IndexArray(n int) uintptr {
	var wrap_this unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_out := C.nav_dtPathCorridor_IndexArray(wrap_this, C.long(n))
	go_out := uintptr(wrap_out)
	return go_out
}

/*
Allocates the corridor's path buffer.

@param maxPath The maximum path size the corridor can handle.
@return True if the initialization succeeded.

public bool init(int const maxPath)
*/
func (p DtPathCorridorPtr) Init(maxPath int32) bool {
	var wrap_this unsafe.Pointer
	var wrap_arg_maxPath C.int
	wrap_this = unsafe.Pointer(p)
	wrap_arg_maxPath = (C.int)(maxPath)
	wrap_out := C.nav_dtPathCorridor_init(wrap_this, wrap_arg_maxPath)
	go_out := bool(wrap_out)
	return go_out
}

/*
Checks the current corridor path to see if its polygon references remain valid.

@param maxLookAhead The number of polygons from the beginning of the corridor to search.
@param navquery The query object used to build the corridor.
@param filter The filter to apply to the operation.

public bool isValid(int const maxLookAhead, dtNavMeshQuery * navquery, dtQueryFilter const * filter)
*/
func (p DtPathCorridorPtr) IsValid(maxLookAhead int32, navquery DtNavMeshQueryPtr, filter DtQueryFilterPtr) bool {
	var wrap_this unsafe.Pointer
	var wrap_arg_maxLookAhead C.int
	var wrap_arg_navquery unsafe.Pointer
	var wrap_arg_filter unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_arg_maxLookAhead = (C.int)(maxLookAhead)
	wrap_arg_navquery = (unsafe.Pointer)(navquery)
	wrap_arg_filter = (unsafe.Pointer)(filter)
	wrap_out := C.nav_dtPathCorridor_isValid(wrap_this, wrap_arg_maxLookAhead, wrap_arg_navquery, wrap_arg_filter)
	go_out := bool(wrap_out)
	return go_out
}

/*
public bool moveOverOffmeshConnection(dtPolyRef offMeshConRef, dtPolyRef * refs, float * startPos, float * endPos, dtNavMeshQuery * navquery)
*/
func (p DtPathCorridorPtr) MoveOverOffmeshConnection(offMeshConRef uint32, refs *uint32, startPos *float32, endPos *float32, navquery DtNavMeshQueryPtr) bool {
	var wrap_this unsafe.Pointer
	var wrap_arg_offMeshConRef C.uint
	var wrap_arg_refs unsafe.Pointer
	var wrap_arg_startPos unsafe.Pointer
	var wrap_arg_endPos unsafe.Pointer
	var wrap_arg_navquery unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_arg_offMeshConRef = (C.uint)(offMeshConRef)
	wrap_arg_refs = (unsafe.Pointer)(refs)
	wrap_arg_startPos = (unsafe.Pointer)(startPos)
	wrap_arg_endPos = (unsafe.Pointer)(endPos)
	wrap_arg_navquery = (unsafe.Pointer)(navquery)
	wrap_out := C.nav_dtPathCorridor_moveOverOffmeshConnection(wrap_this, wrap_arg_offMeshConRef, wrap_arg_refs, wrap_arg_startPos, wrap_arg_endPos, wrap_arg_navquery)
	go_out := bool(wrap_out)
	return go_out
}

/*
Moves the position from the current location to the desired location, adjusting the corridor
as needed to reflect the change.

@param npos The desired new position. [(x, y, z)]
@param navquery The query object used to build the corridor.
@param filter The filter to apply to the operation.
@return Returns true if move succeeded.

public bool movePosition(float const * npos, dtNavMeshQuery * navquery, dtQueryFilter const * filter)
*/
func (p DtPathCorridorPtr) MovePosition(npos *float32, navquery DtNavMeshQueryPtr, filter DtQueryFilterPtr) bool {
	var wrap_this unsafe.Pointer
	var wrap_arg_npos unsafe.Pointer
	var wrap_arg_navquery unsafe.Pointer
	var wrap_arg_filter unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_arg_npos = (unsafe.Pointer)(npos)
	wrap_arg_navquery = (unsafe.Pointer)(navquery)
	wrap_arg_filter = (unsafe.Pointer)(filter)
	wrap_out := C.nav_dtPathCorridor_movePosition(wrap_this, wrap_arg_npos, wrap_arg_navquery, wrap_arg_filter)
	go_out := bool(wrap_out)
	return go_out
}

/*
Moves the target from the curent location to the desired location, adjusting the corridor
as needed to reflect the change.

@param npos The desired new target position. [(x, y, z)]
@param navquery The query object used to build the corridor.
@param filter The filter to apply to the operation.
@return Returns true if move succeeded.

public bool moveTargetPosition(float const * npos, dtNavMeshQuery * navquery, dtQueryFilter const * filter)
*/
func (p DtPathCorridorPtr) MoveTargetPosition(npos *float32, navquery DtNavMeshQueryPtr, filter DtQueryFilterPtr) bool {
	var wrap_this unsafe.Pointer
	var wrap_arg_npos unsafe.Pointer
	var wrap_arg_navquery unsafe.Pointer
	var wrap_arg_filter unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_arg_npos = (unsafe.Pointer)(npos)
	wrap_arg_navquery = (unsafe.Pointer)(navquery)
	wrap_arg_filter = (unsafe.Pointer)(filter)
	wrap_out := C.nav_dtPathCorridor_moveTargetPosition(wrap_this, wrap_arg_npos, wrap_arg_navquery, wrap_arg_filter)
	go_out := bool(wrap_out)
	return go_out
}

/*
Attempts to optimize the path using a local area search. (Partial replanning.)

@param navquery The query object used to build the corridor.
@param filter The filter to apply to the operation.

public bool optimizePathTopology(dtNavMeshQuery * navquery, dtQueryFilter const * filter)
*/
func (p DtPathCorridorPtr) OptimizePathTopology(navquery DtNavMeshQueryPtr, filter DtQueryFilterPtr) bool {
	var wrap_this unsafe.Pointer
	var wrap_arg_navquery unsafe.Pointer
	var wrap_arg_filter unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_arg_navquery = (unsafe.Pointer)(navquery)
	wrap_arg_filter = (unsafe.Pointer)(filter)
	wrap_out := C.nav_dtPathCorridor_optimizePathTopology(wrap_this, wrap_arg_navquery, wrap_arg_filter)
	go_out := bool(wrap_out)
	return go_out
}

/*
Attempts to optimize the path if the specified point is visible from the current position.

@param next The point to search toward. [(x, y, z])
@param pathOptimizationRange The maximum range to search. [Limit: > 0]
@param navquery The query object used to build the corridor.
@param filter The filter to apply to the operation.

public void optimizePathVisibility(float const * next, float const pathOptimizationRange, dtNavMeshQuery * navquery, dtQueryFilter const * filter)
*/
func (p DtPathCorridorPtr) OptimizePathVisibility(next *float32, pathOptimizationRange float32, navquery DtNavMeshQueryPtr, filter DtQueryFilterPtr) {
	var wrap_this unsafe.Pointer
	var wrap_arg_next unsafe.Pointer
	var wrap_arg_pathOptimizationRange C.float
	var wrap_arg_navquery unsafe.Pointer
	var wrap_arg_filter unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_arg_next = (unsafe.Pointer)(next)
	wrap_arg_pathOptimizationRange = (C.float)(pathOptimizationRange)
	wrap_arg_navquery = (unsafe.Pointer)(navquery)
	wrap_arg_filter = (unsafe.Pointer)(filter)
	C.nav_dtPathCorridor_optimizePathVisibility(wrap_this, wrap_arg_next, wrap_arg_pathOptimizationRange, wrap_arg_navquery, wrap_arg_filter)
}

/*
Resets the path corridor to the specified position.

@param ref The polygon reference containing the position.
@param pos The new position in the corridor. [(x, y, z)]

public void reset(dtPolyRef ref, float const * pos)
*/
func (p DtPathCorridorPtr) Reset(ref uint32, pos *float32) {
	var wrap_this unsafe.Pointer
	var wrap_arg_ref C.uint
	var wrap_arg_pos unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_arg_ref = (C.uint)(ref)
	wrap_arg_pos = (unsafe.Pointer)(pos)
	C.nav_dtPathCorridor_reset(wrap_this, wrap_arg_ref, wrap_arg_pos)
}

/*
Loads a new path and target into the corridor.

@param target The target location within the last polygon of the path. [(x, y, z)]
@param path The path corridor. [(polyRef) * @p npolys]
@param npath The number of polygons in the path.

public void setCorridor(float const * target, dtPolyRef const * polys, int const npath)
*/
func (p DtPathCorridorPtr) SetCorridor(target *float32, polys *uint32, npath int32) {
	var wrap_this unsafe.Pointer
	var wrap_arg_target unsafe.Pointer
	var wrap_arg_polys unsafe.Pointer
	var wrap_arg_npath C.int
	wrap_this = unsafe.Pointer(p)
	wrap_arg_target = (unsafe.Pointer)(target)
	wrap_arg_polys = (unsafe.Pointer)(polys)
	wrap_arg_npath = (C.int)(npath)
	C.nav_dtPathCorridor_setCorridor(wrap_this, wrap_arg_target, wrap_arg_polys, wrap_arg_npath)
}

/*
public bool trimInvalidPath(dtPolyRef safeRef, float const * safePos, dtNavMeshQuery * navquery, dtQueryFilter const * filter)
*/
func (p DtPathCorridorPtr) TrimInvalidPath(safeRef uint32, safePos *float32, navquery DtNavMeshQueryPtr, filter DtQueryFilterPtr) bool {
	var wrap_this unsafe.Pointer
	var wrap_arg_safeRef C.uint
	var wrap_arg_safePos unsafe.Pointer
	var wrap_arg_navquery unsafe.Pointer
	var wrap_arg_filter unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_arg_safeRef = (C.uint)(safeRef)
	wrap_arg_safePos = (unsafe.Pointer)(safePos)
	wrap_arg_navquery = (unsafe.Pointer)(navquery)
	wrap_arg_filter = (unsafe.Pointer)(filter)
	wrap_out := C.nav_dtPathCorridor_trimInvalidPath(wrap_this, wrap_arg_safeRef, wrap_arg_safePos, wrap_arg_navquery, wrap_arg_filter)
	go_out := bool(wrap_out)
	return go_out
}

/*
int dtMergeCorridorEndMoved(dtPolyRef * path, int const npath, int const maxPath, dtPolyRef const * visited, int const nvisited)
*/
func DtMergeCorridorEndMoved(path *uint32, npath int32, maxPath int32, visited *uint32, nvisited int32) int32 {
	var wrap_arg_path unsafe.Pointer
	var wrap_arg_npath C.int
	var wrap_arg_maxPath C.int
	var wrap_arg_visited unsafe.Pointer
	var wrap_arg_nvisited C.int
	wrap_arg_path = (unsafe.Pointer)(path)
	wrap_arg_npath = (C.int)(npath)
	wrap_arg_maxPath = (C.int)(maxPath)
	wrap_arg_visited = (unsafe.Pointer)(visited)
	wrap_arg_nvisited = (C.int)(nvisited)
	wrap_out := C.nav_dtMergeCorridorEndMoved(wrap_arg_path, wrap_arg_npath, wrap_arg_maxPath, wrap_arg_visited, wrap_arg_nvisited)
	go_out := int32(wrap_out)
	return go_out
}

/*
int dtMergeCorridorStartMoved(dtPolyRef * path, int const npath, int const maxPath, dtPolyRef const * visited, int const nvisited)
*/
func DtMergeCorridorStartMoved(path *uint32, npath int32, maxPath int32, visited *uint32, nvisited int32) int32 {
	var wrap_arg_path unsafe.Pointer
	var wrap_arg_npath C.int
	var wrap_arg_maxPath C.int
	var wrap_arg_visited unsafe.Pointer
	var wrap_arg_nvisited C.int
	wrap_arg_path = (unsafe.Pointer)(path)
	wrap_arg_npath = (C.int)(npath)
	wrap_arg_maxPath = (C.int)(maxPath)
	wrap_arg_visited = (unsafe.Pointer)(visited)
	wrap_arg_nvisited = (C.int)(nvisited)
	wrap_out := C.nav_dtMergeCorridorStartMoved(wrap_arg_path, wrap_arg_npath, wrap_arg_maxPath, wrap_arg_visited, wrap_arg_nvisited)
	go_out := int32(wrap_out)
	return go_out
}

/*
int dtMergeCorridorStartShortcut(dtPolyRef * path, int const npath, int const maxPath, dtPolyRef const * visited, int const nvisited)
*/
func DtMergeCorridorStartShortcut(path *uint32, npath int32, maxPath int32, visited *uint32, nvisited int32) int32 {
	var wrap_arg_path unsafe.Pointer
	var wrap_arg_npath C.int
	var wrap_arg_maxPath C.int
	var wrap_arg_visited unsafe.Pointer
	var wrap_arg_nvisited C.int
	wrap_arg_path = (unsafe.Pointer)(path)
	wrap_arg_npath = (C.int)(npath)
	wrap_arg_maxPath = (C.int)(maxPath)
	wrap_arg_visited = (unsafe.Pointer)(visited)
	wrap_arg_nvisited = (C.int)(nvisited)
	wrap_out := C.nav_dtMergeCorridorStartShortcut(wrap_arg_path, wrap_arg_npath, wrap_arg_maxPath, wrap_arg_visited, wrap_arg_nvisited)
	go_out := int32(wrap_out)
	return go_out
}

/*
dtPathCorridor * NewDtPathCorridorPtrArray(long n)
*/
func NewDtPathCorridorPtrArray(n int) cgo.GoManagedPtr[cgo.Array[DtPathCorridorPtr]] {
	wrap_out := C.nav_NewDtPathCorridorPtrArray(C.long(n))
	go_out := cgo.MakePtr[cgo.GoManagedPtr[cgo.Array[DtPathCorridorPtr]]](uintptr(wrap_out))
	return go_out
}
